{extend name="public:base" /}

{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb2}
		</small>
	</h1>
</div>	
<div class="page-header">
	<a href="{:url('admin/variety/add')}" class="btn btn-primary">新增</a>
</div>		
	
	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>		
						<th>ID</th>									
						<th>品种名称</th>
						<th>品种编号</th>
						<th>交易所</th>  				
						<th>正在交易状态</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="d" empty="$empty"}
						<tr>		
							<td>{$d.id}</td>					
							<td>{$d.name}</td>
							<td>{$d.variety_id}</td>
							<td>


							{volist name="exchange" id="e" empty="$empty"}
								{if condition="$d.exchange_id eq $e.id"}
                  			       {$e.name}
                  			   {/if}
							{/volist}
							</td>
							<td>
								{switch name="d.use_state"}
								{case value="1"}<a href='{:url("Variety/use_state",array("id"=>$d["id"],"status"=>1))}' title="是"><span class="btn btn-xs btn-success"><i class="fa fa-check bigger-120"></i></span></a>{/case}
								{case value="0"}<a href='{:url("Variety/use_state",array("id"=>$d["id"],"status"=>0))}' title="否"><span class="btn btn-xs btn-danger"><i class="fa fa-remove bigger-120"></i></span></a>{/case}
								{/switch}
							</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:url("variety/edit",array("id"=>$d["id"]))}'>
									<i class="fa fa-edit bigger-120"></i>
								</a> 
								<a class="delete btn btn-xs btn-danger" href='{:url("variety/delete_Variety",array("id"=>$d["id"]))}' >
									<i class="fa fa-trash bigger-120"></i>
								</a>

							</td>
						</tr>
						{/volist}	
						
						<tr>
							<td colspan="20" class="page">{$list->render()}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	
});
</script>
{/block}